#include <stdio.h>
int main()
{
	int x;
	int ge,shi,bai;
	scanf("%d",&x);
	ge = x %10;
	shi =(x/10)%10;
	bai  = x/100;
	if(x = ge*ge+shi*shi+bai*bai)
	  printf("1");
	  else
	  printf("0");
	
	
	
	return 0;
 } 
